package com.xnyzc.lhy.order.controller.dapi.vehicle;


import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.order.entity.vehicle.OaCVehicleAccident;
import com.xnyzc.lhy.order.service.vehicle.IOaCVehicleAccidentService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 车辆事故表 前端控制器
 * </p>
 *
 * @author lhy@xnyzc.com
 * @since 2019-07-24
 */
@RestController
@RequestMapping("/oa/dapi/vehicle/oa-cvehicle-accident")
public class OaCVehicleAccidentController {


    @Autowired
    private IOaCVehicleAccidentService vehicleAccidentService;

    @ApiOperation(value = "添加事故信息", notes = "添加事故信息")
    @PostMapping(value = "/addVehicleAccident")
    public Rv addVehicleAccident(OaCVehicleAccident vehicleAccident) {
        return vehicleAccidentService.addVehicleAccident(vehicleAccident);
    }

    @ApiOperation(value = "根据事故ID获取事故实心", notes = "根据事故ID获取事故实心")
    @PostMapping(value = "/getVehicleAccident")
    public Rv getVehicleAccident(Long id) {
        return vehicleAccidentService.getVehicleAccident(id);
    }

    @ApiOperation(value = "根据车辆ID获取车辆故障信息", notes = "根据车辆ID获取车辆故障信息")
    @PostMapping(value = "/listVehicleAccident")
    public Rv listVehicleAccident(
            @ApiParam(name = "vehicleId", value = "司机ID") Long vehicleId,
            @ApiParam(name = "page", value = "当前页") Integer page,
            @ApiParam(name = "limit", value = "每页显示数量") Integer limit
    ) {
        return vehicleAccidentService.listVehicleAccident(vehicleId, page, limit);
    }


}
